home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1996 Christmas / macformat-045.iso / Shareware Plus / Developers / The Gray Council 1.1 / ! Gray Council MacApp Info < prev    next >
Encoding:
Text File  |  1996-08-08  |  13.8 KB  |  212 lines  |  [TEXT/ttxt]

  1. The Gray Council - MacApp Info
  2. Copyright ©1996 by Trygve Isaacson. All Rights Reserved.
  3. <trygve@kagi.com>
  4. <http://www.kagi.com/authors/trygve/>
  5.  
  6. The Gray Council, version 1.1
  7.  
  8. Contents
  9. - Instructions for building the sample app.
  10. - Overview of the Gray Council MacApp adapter classes.
  11. - Instructions for using the MacApp adapter classes.
  12.  
  13. Instructions for building the Gray Council MacApp sample/test application.
  14.  
  15. 1. Open the .π file of choice (68K or PowerPC) with CodeWarrior.
  16.  
  17. 2. Where necessary, change the access paths listed below, and change them so that they point to where you keep the corresponding items on your system. Your MacApp and RIncludes folders may not be located or named the way mine are, so alter these as necessary:
  18.  
  19. a. If your MacApp root folder is sibling with the GrayCouncil root folder and is named "MacApp 3.3", these access paths should be OK the way they are; if not, point them to the right place:
  20.  
  21. - {Project ƒ}::::MacApp 3.3:Libraries:
  22.   (the standard MacApp {MALibraries} folder)
  23. - {Project ƒ}::::MacApp 3.3:Libraries:CW MALibraries:NoDebug 68K: [or PPC]
  24.   (the folder where you keep the CodeWarrior MacApp 68K [or PPC] libraries)
  25. - {Project ƒ}::::MacApp 3.3:Libraries:CW MALibraries:MA Extras:
  26.   (the folder where you keep the CodeWarrior MacApp .pch++ precompiled headers)
  27. - {Project ƒ}::::MacApp 3.3:Interfaces:CPlusIncludes:
  28.   (the standard MacApp {MACPlusIncludes} folder)
  29. - {Project ƒ}::::MacApp 3.3:Interfaces:RIncludes:
  30.   (the standard MacApp {MARIncludes} folder)
  31.  
  32. b. If you have installed the CodeWarrior-supplied MPW into the CW9 Gold folder, this access path should be OK the way it is; if not, point it to the right place:
  33.  
  34. - {Compiler ƒ}::CodeWarrior MPW:Interfaces&Libraries:Interfaces:RIncludes:
  35.   (the standard MPW {RIncludes} folder)
  36.  
  37. 3. Select the Run command to compile, link, and launch the application.
  38.  
  39. Overview of the Gray Council MacApp adapter classes.
  40.  
  41. AGAPushButtonMA
  42.  
  43. Replacement subclass of TButton. Implements the AGA pushbutton by instantiating a core AGAPushButton object.
  44. Recommended dimensions: 20x64 or 20x80, or wider to fit longer title. Add 8x8 for default buttons.
  45.  
  46. AGACheckBoxMA
  47.  
  48. Replacement subclass of TCheckBox. Implements the AGA check box by instantiating a core AGACheckBox object. To use the "mixed-state" capability, call mAGAObject->SetState/GetState.
  49. Minimum dimensions: 12xY.
  50.  
  51. AGARadioButtonMA
  52.  
  53. Replacement subclass of TRadioButton. Implements the AGA radio button by instantiating a core AGARadioButton object. To use the "mixed-state" capability, call mAGAObject->SetState/GetState.
  54. Minimum dimensions: 12xY.
  55.  
  56. AGAIconPushButtonMA
  57.  
  58. Replacement subclass of AGAPushButtonMA (TButton), acts like a regular springloaded pushbutton, but with icon button appearance. Implements the AGA icon button by instantiating a core AGAIconPushButton object. The fUserArea should contain the icon family resource ID.
  59. Recommended dimensions: 22x22 for small icons, 40x40 for large icons.
  60.  
  61. AGAIconCheckBoxMA
  62.  
  63. Replacement subclass of AGACheckBoxMA (TCheckBox), acts like a regular self-toggling check box, but with icon button appearance. Implements the AGA check box by instantiating a core AGAIconCheckBox object. The fUserArea should contain the icon family resource ID. 
  64. Recommended dimensions: 22x22 for small icons, 40x40 for large icons.
  65.  
  66. AGAIconRadioButtonMA
  67.  
  68. Replacement subclass of AGARadioButtonMA (TRadioButton), acts like a regular radio button that can be grouped in a TCluster for mutual exclusivity, but with icon button appearance. The fUserArea should contain the icon family resource ID.
  69. Recommended dimensions: 22x22 for small icons, 40x40 for large icons.
  70.  
  71. AGAScrollBarMA
  72.  
  73. Replacement subclass of TScrollBar. Implements the AGA scroll bar by instantiating a core AGAScrollBar. By default, live scrolling is on and proportional indicator is off. You can change these defaults globally via SetGrayCouncilDefault or per object via SetAttributes.
  74. Recommended dimensions: Xx16 or 16xY.
  75.  
  76. AGAScrollerScrollBarMA
  77.  
  78. Replacement subclass of TScrollerScrollBar. Implements the AGA scroll bar by instantiating a core AGAScrollBar. By default, live scrolling is on and proportional indicator is off. You can change these defaults globally via SetGrayCouncilDefault or per object via SetAttributes.
  79. Recommended dimensions: Xx16 or 16xY.
  80.  
  81. AGASliderMA
  82.  
  83. A subclass of TControl. Implements AGA slider by instantiating a core AGASlider. If the fUserArea contains a valid STR# resource ID, the slider will be labeled/pointy, the slider labels are read from that resource, the slider range is initialized to match the number of labels. Otherwise, the slider will be unlabeled/rectangular.
  84. Minimum dimensions: Xx17 or 17xY.
  85.  
  86. AGABackgroundAdornerMA
  87.  
  88. A subclass of TAdorner. To get a gray window background, attach this adorner to the window in front of the Draw adorner. This adorner is for a modeless window, such as a document window.
  89.  
  90. AGAModalBackgroundAdornerMA
  91.  
  92. A subclass of TAdorner. To get a gray dialog background, attach this adorner to the dialog in front of the Draw adorner. This adorner is for a modal window, such as a modal dialog box or movable modal dialog window.
  93.  
  94. AGAWhiteBackgroundAdornerMA
  95.  
  96. A subclass of TAdorner. To get a white subview background against a gray window background, attach this adorner to the subview in front of the Draw adorner. This adorner will be common for editable text views and list views, usually used with a AGABorderFrameAdornerMA.
  97.  
  98. AGABorderFrameAdornerMA
  99.  
  100. A subclass of TAdorner. To get a "3D" sunken subview frame, attach this adorner to the subview behind the Draw adorner. This adorner will be common for editable text views and list views, usually used with a AGAWhiteBackgroundAdornerMA.
  101.  
  102. AGAPopupMA
  103.  
  104. Replacement subclass of TPopup. Implements the AGA popup menu by instantiating a core AGAPopupMenu.
  105. Recommended dimensions: 20xY. Supports a horizontal size determiner of variable or fixed width; fixed width means that the view is always drawn to fill the width of the view, while variable means it shrinks to fit the actual width.
  106.  
  107. AGAStaticTextMA
  108.  
  109. Replacement subclass of TStaticText. Implements static text that draws disabled in "real" gray (not qd.gray erase patBic), and erases to gray on a non-white background, by instantiating a core AGAStaticText. You can just use TStaticText if you do not change the text while the window is visible, but if you update the text while the window is open, use AGAStaticTextMA to avoid a white hole in the window; otherwise you'll need to attach a gray background adorner to the view...
  110. Recommended dimensions: n/a; depends on font size.
  111.  
  112. AGALittleArrowsMA
  113.  
  114. A subclass of TControl. Implements AGA little arrows by instantiating a core AGALittleArrows. If the fUserArea contains the subview ID of a TNumberText subview in the same window, the little arrows will automatically increment/decrement the value of the number field.
  115. Minimum dimensions: 23x13.
  116.  
  117. AGADisclosureTriangleMA
  118.  
  119. A subclass of TControl. Implements AGA disclosure triangle by instantiating a core AGADisclosureTriangle.
  120. Minimum dimensions: 10x10.
  121.  
  122. AGAProgressIndicatorMA
  123.  
  124. A subclass of TControl. Implements AGA determinate and indeterminate progress indicators by instantiating a core AGAProgress indicator. To set the indicator's min/max range, call mAGAObject->SetRange. If you set min=max, you get an indeterminate indicator. Call mAGAObject->SetValue or Increment to prod a determinate indicator; call mAGAObject->Animate to rotate an indeterminate indicator once.
  125. Required dimensions: Xx14.
  126.  
  127. AGASeparatorMA
  128.  
  129. A subclass of TView. Implements AGA separator by instantiating a core AGASeparator. The larger dimension (h/v) is the direction that the separator is drawn.
  130. Minimum dimensions: Xx2 or 2xY.
  131.  
  132. AGATargetBorderViewMA
  133.  
  134. Replacement subclass of TTargetBorderView. Implements AGA keyboard focus frame by changing the color and shape of the target border.
  135. Recommended dimensions: n/a; fit to contain subview.
  136.  
  137. AGATargetBorderFrameViewMA
  138.  
  139. Replacement subclass of AGATargetBorderViewMA (TTargetBorderView). In addition to the AGA keyboard focus indicator, draws a "3D" sunken subview frame exactly like the AGABorderFrameAdornerMA. This is so that you don't have to also attach an AGABorderFrameAdornerMA to the subview.
  140. Recommended dimensions: n/a; fit to contain subview.
  141.  
  142. AGAGroupBoxMA
  143.  
  144. Replacement subclass of TCluster. Implements AGA primary group box by instantiating a core AGAGroupBox set for "primary" look. Differs from TCluster in that if it has no title it still draws, so if you want a non-visible cluster, just use a TCluster. If the fUserArea contains the subview ID of a sibling subview, that other view's width will be used to determine the "title gap" that is left blank for the other view to occupy.
  145. Recommended dimensions: n/a; fit to contain subviews. If you use a sibling view for the title gap, you'll need to locate it at the correct location to sit in the title gap. As an example, if you use a 16xY check box for the group box title, the check box view should be located at left+14, top-9 relative to the group box. To conform precisely to the AGA guidelines, the title's baseline should match the group box top, and there should be 3 blank pixels on each side of the title.
  146.  
  147. AGASecondaryGroupBoxMA
  148.  
  149. Replacement subclass of AGAGroupBoxMA (TCluster). Implements AGA secondary group box by instantiating a core AGAGroupBox set for "secondary" look.
  150. Recommended dimensions: same as for AGAGroupBoxMA.
  151.  
  152. Instructions for using the Gray Council MacApp adapter classes.
  153.  
  154. 1. Adding the Gray Council files to your project.
  155.  
  156. Your project needs to add two Gray Council files:
  157.  
  158. - GrayCouncil.cpp (the core classes)
  159. - GrayCouncilMA.cpp (the MacApp adapter classes)
  160.  
  161. You also need to have the path to the corresponding header files in your Access Paths. One path that is usually missing from the CodeWarrior project stationery, and which is used by the GrayCouncil code, is:
  162. {Compiler ƒ}:MacOS Support:Headers:STL Headers:
  163.  
  164. The Gray Council .cpp and .h files don't rely on any particular folder hierarchy, so you can organize them however you want. (However, the provided sample app has certain relative file path assumptions, as discussed earlier.)
  165.  
  166. If it's not already in the project, you will need to add the PLStringFuncs glue, which is used by the core Gray Council code.
  167. The 68K version is ":MacOS Support:Libraries:MacOS 68K:MacOS Files:PLStringFuncs.glue.lib"
  168. The PPC version is ":MacOS Support:Libraries:MacOS PPC:PLStringFuncs Glue:PLStringFuncsPPC.lib"
  169.  
  170. 2. Initializing.
  171.  
  172. You must call InitGrayCouncilMA() after MacApp has initialized the toolbox but before you instantiate any Gray Council objects. You should FailOSErr() on the result. This function call registers the MacApp adapter view classes and then calls InitGrayCouncil.
  173.  
  174. 3. Specifying the view class.
  175.  
  176. (Note: feel free to open the file MyApplication.rsrc with AdLib to see the details of the view resources used for the sample app.)
  177.  
  178. For resource-based views, you just need to set the class name of the subview in the resource. For most views, this is all you need to do; in some of the fancier classes, you will also want to set attributes at runtime. Some classes also support use of the "user area" field to specify attributes. You can also statically instantiate views at runtime; each class has a MacApp-style "I" method that you must call to initialize the object.
  179.  
  180. - For an AdLib or ViewEdit resource file, simply go to the subview's class name field and type in the new class name. Make sure you use the MacApp adapter class name (ending in "MA"), not the core Gray Council class name.
  181.  
  182. - For a derezzed View in a .r file, you type the Gray Council MacApp adapter class name between the "" double quotes near the top of the subview's definition. For example, where you previously had:
  183.  
  184.         ViewSignatureAndClassname {
  185.             'butn',
  186.             206,
  187.             "",
  188.  
  189. ...change it to:
  190.  
  191.         ViewSignatureAndClassname {
  192.             'butn',
  193.             206,
  194.             "AGAPushButtonMA",
  195.  
  196. 4. Setting the fUserArea.
  197.  
  198. The following summarizes how the "user area" or "user data" field of a subview in a resource specifies additional information for certain classes (zero means to ignore it). This information is also listed in the class overviews above.
  199.  
  200. AGAIconPushButtonMA::fUserArea specifies the resource ID of an icon family for the icon button.
  201. AGAIconCheckBoxMA::fUserArea specifies the resource ID of an icon family for the icon button.
  202. AGAIconRadioButtonMA::fUserArea specifies the resource ID of an icon family for the icon button.
  203. AGASliderMA::fUserArea specifies the STR# resource ID of the slider labels.
  204. AGALittleArrowsMA::fUserArea specifies the IDType of a TNumberText subview in the same window to be automatically linked to the arrows.
  205. AGAGroupBoxMA::fUserArea specifies the IDType of a sibling subview whose width will be used to determine the "title gap" of the group box.
  206.  
  207. 5. Changing attributes at runtime.
  208.  
  209. Once you have a Gray Council view instantiated, either from a view resource or statically, you will want to do something with it! For the MacApp replacement subclasses, you can probably just plug them in; all standard functions like TCheckBox::Toggle and TPopup::GetCurrentItem will continue to work for the replacement subclasses. The only thing you need to avoid (and you should already be avoiding this) is for TCtlMgr subclasses, don't set or get the control manager value directly. You can continue to use the Set/GetLongMax functions, and you'll still be OK.
  210.  
  211. For some classes, there is no MacApp equivalent, so you'll need to call the view's mAGAObject-> functions directly. (This is why the mAGAObject data member is made public: so you can just call though without going through an accessor.) There is really only one thing to be careful of: focusing. Because the core AGA classes are designed to be ultra lightweight, they do not store a GrafPtr. They assume that the port is set up by the caller. So you must make sure that the view is focused before you explicitly call an AGAObject function that will cause drawing. The MacApp adapter classes already do this by calling this->Focus() where necessary.
  212.